﻿namespace WinFormSession
{
    using System;
    using System.Collections;
    using System.Reflection;

    public class WinformSession : DictionaryBase
    {
        private static WinformSession assion = null;

        private WinformSession()
        {
        }

        public void Add(string newID, object newmember)
        {
            try
            {
                base.Dictionary.Add(newID, newmember);
            }
            catch
            {
            }
        }

        public static WinformSession GetSession()
        {
            if (assion == null)
            {
                assion = new WinformSession();
            }
            return assion;
        }

        public void Remove(string memberID)
        {
            try
            {
                base.Dictionary.Remove(memberID);
            }
            catch
            {
            }
        }

        public object this[string memberID]
        {
            get
            {
                try
                {
                    return base.Dictionary[memberID];
                }
                catch
                {
                    return null;
                }
            }
            set
            {
                try
                {
                    base.Dictionary.Add(memberID, value);
                }
                catch
                {
                }
            }
        }
    }
}

